home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Megahits 3
/
Megahits 3 (1994)(GTI - Rhein-Main-Soft)(DE)[!].iso
/
module
/
utilities
/
archives
/
musicxstuff.lha
/
RexxEdit.doc
< prev
Wrap
Text File
|
1990-08-04
|
11KB
|
259 lines
RexxEdit Module for Music-X - ©1990 MicroIllusions, Inc.
Introduction:
"RexxEdit" is a module that allows Music-X to call an ARexx macro
program, which can in turn edit the events in a sequence. This module only
works in the Editor pages (the Bar and Event Editor). The module will attempt
to start-up the ARexx server, "RexxMast," if it is not already activated.
When RexxEdit module is selected from the Module Menu, a file requester
will open so the user can select an ARexx program to run. The module first
looks for the logical assign "MXRexx:" and, if found, shows the contents of
that drawer. If "MXRexx:" is not found, the logical assign "Rexx:" (where all
standard ARexx programs are kept) will be searched for and, if found,
displayed. If "Rexx:" cannot be found, then the contents of Music-X's own
drawer will be displayed.
After selecting the ARexx program from the file requester and clicking on
"OK", the module will run the ARexx program. The ARexx program can access the
events in the currently displayed sequence by calling "external functions"
that are contained within the RexxEdit module. These functions can be used to
scan through the events; insert, delete or change events; or get information
about the current Bar Editor enviroment. In addition, the ARexx program can
create a module requester with buttons, sliders, etc., and then discover what
setting the user chose.
When the ARexx program terminates, whether through normal execution or
because of an error, the module will exit and return control to Music-X. Any
changes made be the ARexx program will then be displayed.
Writting an ARexx Program for Editing:
First, RexxEdit always returns results from any function call, so the
line "options results" must appear near the beginning of the ARexx program.
RexxEdit uses the "Rexx Variable Interface" for editing events, which means
that RexxEdit communcates information about events by directly reading or
changing variables in the ARexx program. The most important of these
variables are those with the stem "EVENT".
To begin editing a sequence, the function BEGINSCAN must be called with a
parameter indicating whether "all" or just "selected" events are being
scanned for. When done editing a sequence, the program must call ENDSCAN. (If
a program terminates by error during an editing section, a default ENDSCAN
will be performed.)
To get each event in the sequence, the program must call NEXTEVENT. This
will cause a number of variables with the stem "EVENT" to be created or
filled-in. For instance, a control change event would have the variables
EVENT.TYPE, EVENT.CHANNEL, EVENT.NUM, EVENT.VALUE, EVENT.START.BARS,
EVENT.START.CLOCKS, etc., set to the values contained in the event in the
sequence. There is a table below which gives all the possible variables for
each event type.
The program could then change these values and replace the event by
calling REPLEVENT. Or it could change the values and ask that this be
inserted as a new event with ADDEVENT. Or the event could just be deleted by
calling REMEVENT. If the program wanted to quickly copy the event to another
stem variable, it could call COPYEVENT with the name of the stem.
RexxEdit also allows the program to peek ahead to look at other events by
calling PEEKEVENT with stem variable to return the result in and the number
of events to peek ahead. Note that the peek-ahead event cannot be editted
(although this may change in a future release of RexxEdit).
User Interface Functions:
Unless the ARexx program only does some simple action (like remove all
events after an END event), it is likely that the program will need some
input from the user. This is provided by the "algoritmic module requester
design functions" -- quite a name, huh? The program first defines the type of
controls it desires in the requester and then calls MXREQUEST with the name
of the requester and an optional name for the "PROCEED" button. The following
types of controls are available in this release:
MXBUTTON - A toggle button with a label to the right of it.
MXRADIO - A set of mutually exclusive buttons with labels next to them.
MXSLIDER - A slider with a label to the left of it. The minimum and
maximum values are given as paramters. The minimum value must be positive or
zero and cannot be greater than 255.
MXMIRROR - Another slider which goes from a negative to positive value.
MXNOTESIZE - Puts up one of those note size selection gadgets (like the
Grid Requester has), including a slider and a label to the left of the
slider.
So, to create a requester with a slider asking for a note transposition
value, a radio button set to chose selected or all events, and having an
alternate name to PROCEED control of "TRANSPOSE", the program would do as
follows (/* ... */ being comments):
MXMIRROR "Note Value:,127" /* -127 to 127 */
MXRADIO "Selected events,All events"
MXREQUEST "TRANSPOSE NOTES,TRANSPOSE"
When MXREQUEST returns, the program can query the button and slider
settings by calling MXVALUE with the number of the control (starting at
zero). In the above example the MXMIRROR slider would be control 0, while the
MXRADIO set would be control 1. The value is returned in the global ARexx
variable "RESULT".
In addition to the button layout functions, the program can put up a
message at any time be calling MXREPORT. The program can also change the
pointer (to indicate the program is busy) by calling MXPOINTER with either
the parameter "sleepy" or "normal".
(A Short) Summary of Functions:
Event Editing:
BEGINSCAN 'mode'
Starts an event scan. 'mode' is either 'all' or 'selected'.
Returns 1 if the scan started properly, returns 0 on an error.
ENDSCAN
End a scan. Must be called before starting a new scan or when exiting
from execution.
NEXTEVENT
Read the next event into the stem variable "EVENT". Returns 1 if
everything went well, returns 0 if something went wrong or there are no more
events.
PEEKEVENT 'stem[,count]'
Peek ahead by 'count' events (defaults to 1) and place the resulting
information in the variable 'stem'. Returns either 1 (success) or 0
(failure).
ADDEVENT
Uses the values in the stem variable "EVENT" to create a new event and
add it to the sequence. Returns either 1 (success) or 0 (failure).
REMEVENT
Removes the current event. Returns either 1 (success) or 0 (failure).
REPLEVENT
Uses the values in the stem variable "EVENT" to replace the values in the
current event. Returns either 1 (success) or 0 (failure).
COPYEVENT 'stem'
Copies the values in variable "EVENT" to the variable 'stem'. Returns
either 1 (success) or 0 (failure).
Requester and Control Handling:
MXBUTTON 'label'
Creates a toggle button with 'label' printed to the right. Returns either
1 (success) or 0 (could not create control).
MXRADIO 'label1,label2,...'
Creates a set of mutually exclusive buttons (maximum of 5 in the set)
with 'label1,label2,...' printed to the right of each button. Returns either
1 (success) or 0 (could not create control).
MXSLIDER 'label,minval,maxval'
Creates a slider with 'minval' and 'maxval'. 'minval' must be positive or
zero and cannot be greater than 255. 'label' is printed to the left of the
slider. Returns either 1 (success) or 0 (could not create control).
MXMIRROR 'label,maxval'
Creates a slider whose maximum value is 'maxval' and minimum is negative
'maxval'. 'label' is printed to the left of the slider. Returns either 1
(success) or 0 (could not create control).
MXNOTESIZE 'label'
Creates a set of note selection controls (including a slider) like the
ones in the Grid Requester. 'label' is printed to the left of the slider.
Returns either 1 (success) or 0 (could not create control).
MXREQUEST 'title[,proceed]'
Put up a requester containing all previously defined controls, plus
PROCEED and CANCEL controls. The requester will have be labeled 'title'.
Optionally, the PROCEED control can be relabeled. Returns 1 if the user
wanted to proceed, 0 if the user wanted to cancel.
MXVALUE which
Returns the final value of control 'which'. For a MXBUTTON, the value is
0 if the control was unselected and 1 if selected. For a MXRADIO, the value
if the button hilites with the first button being 0, the second 1, etc. For
MXSLIDER, MXMIRROR and MXNOTESIZE controls, returns the slider setting.
Other Functions:
MXREPORT 'message1[,message2]'
Put up a message box where the first line is 'message1' and the optional
second line is 'message 2'.
MXPOINTER 'mode'
Change the Music-X pointer to either 'normal' mode or 'sleepy' mode.
GETBARDATA
Put the values of the current grid and step size in the Bar editor into
the variables BARDATA.GRID and BARDATA.STEP, respectfully.
Variables Returned by NEXTEVENT:
All events have an EVENT.TYPE, which is a string. If the sequence uses
relative time, the variable EVENT.CLOCKTYPE will be set to 'REL' and the
variables EVENT.START.BARS and EVENT.START.CLOCKS will contain the event's
measure and ticks in measure start times, while EVENT.START.TICKS will
contain the total number of ticks from the start of the sequence. Absolute
sequences will have a EVENT.CLOCKTYPE of 'ABS' and have the variable
EVENT.START.QFRAMES which contains the event's start time in quarter-frames.
If the event also has a stop time, additional time vaiables will be defined
as above except with START replaced by STOP. If the event has a channel
assignment, EVENT.CHANNEL will be defined. All other variables vary by event
type as note in the list below.
Event types and variables:
'END' - an END event
(no extra variables)
'STOP' - a stop sequence event
(no extra variables)
'REPT' - a repeat count
EVENT.NUM - the number of repeats
'TSIG' - a time signature change
EVENT.NUM - the numerator of the time signature
EVENT.DEM - the denominator of the time signature as a power of two
'KMAP' - keymap change
EVENT.MAP - number of the keymap
'SYSX' - real-time system exclusive
EVENT.NUM - number of bytes of data in this event
EVENT.DATA - a packed string of the data
EVENT.LAST - 0 if this is not the last event for this SYSX packet
1 if this is the last event in the packet
'PSEQ' - play sequence event
EVENT.NUM - number of the sequence to play
EVENT.TRANSPOSE - transposition value
EVENT.CUT - cut value
'TEMP' - tempo change
EVENT.NUM - new tempo value
'MSEQ' - mute sequence
EVENT.NUM - sequence to mute
'SSEQ' - solo sequence
EVENT.NUM - sequence to solo
'MTRK' - mute track
EVENT.NUM - track to mute
'STRK' - solo track
EVENT.NUM - track to solo
'NOTE' - note event
EVENT.NUM - midi note number
EVENT.ATTACK - attack velocity
EVENT.RELEASE - release velocity
'PAT' - polyphonic aftertouch
EVENT.NUM - note number
EVENT.PRESSURE - new pressure
'CTL' - control change
EVENT.NUM - controller number
EVENT.VALUE - new value
'PGM' - program change
EVENT.NUM - program number
'CAT' - channel aftertouch
EVENT.PRESSURE - new presssure value
'PBEN' - pitch bend
EVENT.NUM - pitch bend value